home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-09-30 | 929 b | 33 lines |
- //
- // parameters are inside wrl file.
- //
-
- import vrml.*;
- import vrml.node.*;
- import vrml.field.*;
-
- public class ValueInWrl extends Script{
- SFVec3f set_translation;
- float currentPosition[] = new float[3];
- float offset[] = new float[3];
-
- public void initialize(){
- // get the reference of the event out 'set_translation'.
- set_translation = (SFVec3f)getEventOut("set_translation");
-
- // initialize currentPosition and offset.
- ((SFVec3f)getField("currentPosition")).getValue(currentPosition);
- ((SFVec3f)getField("offset")).getValue(offset);
- }
-
- public void processEvent(Event e){
- if(e.getName().equals("touched") == true){
- currentPosition[0] += offset[0];
- currentPosition[1] += offset[1];
- currentPosition[2] += offset[2];
- set_translation.setValue(currentPosition);
- }
- }
- }
-
-